<?php
/* Add a user */
	include('config/config.php');
	include('config/funcs.php');
	global $CONFIG;
// connect to the database
	$link = mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);

echo "<html><head><title>add user</title></head><body>";

echo "<p>";

/* check to see if POST is null */
if ($_POST != $NULL){
$userName=$_POST['userName'];
$userPass=$_POST['userPass'];
$confirmPass=$_POST['confirmPass'];


	if(isset($_POST['submit']) && $userPass == $confirmPass){
		/* add user and password */
		/* echo $userName."<br />";
		echo $userPass."<br />"; */
		$dbQuery="CREATE USER {$userName}@".$CONFIG['dbserver']." IDENTIFIED BY '{$userPass}'";
		//echo $dbQuery;
		mysql_query($dbQuery) or die("Something fucked up". mysql_error());
		echo mysql_error();
		echo "User ".$userName." Added successfully<br /> <a href=\"index.php\">Back</a>";

	}
	
	else {
		echo "Passwords must match <br /> <a href=\"index.php\">Back</a>";
		
	}
}
else {
	/* if POST is null, tell em to fix it */
	echo "Say what now?  You gotta fill in both fields!";
}
echo "</p>";
echo "</body></html>";
?>
